function(luisa_compute_add_executable name)
    add_executable(${name} ${ARGN})
    target_link_libraries(${name} PRIVATE luisa::compute)
    install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endfunction()

luisa_compute_add_executable(test_type test_type.cpp)
luisa_compute_add_executable(test_ast test_ast.cpp)
luisa_compute_add_executable(test_dsl test_dsl.cpp)
luisa_compute_add_executable(test_dsl_multithread test_dsl_multithread.cpp)
luisa_compute_add_executable(test_dsl_sugar test_dsl_sugar.cpp)
luisa_compute_add_executable(test_runtime test_runtime.cpp)
luisa_compute_add_executable(test_printer test_printer.cpp)
luisa_compute_add_executable(test_simple test_simple.cpp)
luisa_compute_add_executable(test_texture_io test_texture_io.cpp)
luisa_compute_add_executable(test_texture test_texture.cpp)
luisa_compute_add_executable(test_builtin test_builtin.cpp)
luisa_compute_add_executable(test_atomic test_atomic.cpp)
luisa_compute_add_executable(test_sampler test_sampler.cpp)
luisa_compute_add_executable(test_bindless_texture test_bindless_texture.cpp)
luisa_compute_add_executable(test_bindless_buffer test_bindless_buffer.cpp)
luisa_compute_add_executable(test_bindless_buffer2 test_bindless_buffer2.cpp)
luisa_compute_add_executable(test_rtx test_rtx.cpp)
luisa_compute_add_executable(test_ispc_101 test_ispc_101.cpp)
luisa_compute_add_executable(test_command_reorder test_command_reorder.cpp)
luisa_compute_add_executable(test_command_schedule test_command_schedule.cpp)
luisa_compute_add_executable(test_thread_pool test_thread_pool.cpp)
luisa_compute_add_executable(test_sdf_renderer test_sdf_renderer.cpp)
luisa_compute_add_executable(test_sturct_param test_sturct_param.cpp)

if (LUISA_COMPUTE_ENABLE_GUI)
    luisa_compute_add_executable(test_game_of_life test_game_of_life.cpp)
    luisa_compute_add_executable(test_photon_mapping test_photon_mapping.cpp)
    luisa_compute_add_executable(test_shader_toy test_shader_toy.cpp)
    luisa_compute_add_executable(test_path_tracing test_path_tracing.cpp)
    luisa_compute_add_executable(test_path_tracing_buffer test_path_tracing_buffer.cpp)
    luisa_compute_add_executable(test_normal_encoding test_normal_encoding.cpp)
    luisa_compute_add_executable(test_mpm88 test_mpm88.cpp)
    luisa_compute_add_executable(test_mpm3d test_mpm3d.cpp)
    luisa_compute_add_executable(test_radiative_bp test_radiative_bp.cpp)
    luisa_compute_add_executable(test_image_byte4 test_image_byte4.cpp)
    if (APPLE)
        luisa_compute_add_executable(test_shader_toy_present test_shader_toy_present.cpp)
        luisa_compute_add_executable(test_shader_visuals_present test_shader_visuals_present.cpp)
        luisa_compute_add_executable(test_path_tracing_present test_path_tracing_present.cpp)
    endif ()
endif ()
